// 引入所有的模块
const modulesFiles = import.meta.glob('../views/**/*.vue')
const routes = Object.keys(modulesFiles).map(item => {
  const path = '/' + item.match(/\/views\/(.*).vue$/)[1]
  const arr = item.split('/')
  const name = arr[arr.length - 1].match(/(.*).vue$/)[1]
  if (path === '/home/home') {
    return { name, path: '/', component: modulesFiles[item] }
  }
  return { name, path, component: modulesFiles[item] }
})

// import home from '../views/home/home.vue'
// import test from '../views/test/test.vue'

// const routes = [
//   { path: '/', component: home },
//   { path: '/test/test', component: test }
// ]
export default routes
